package db.domain;

import sf.core.DBObject;
import sf.database.annotations.Comment;
import sf.database.annotations.CreatedDate;
import sf.database.annotations.LastModifiedDate;
import sf.database.annotations.SavedDefaultValue;

import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

public abstract class PublicField extends DBObject {
    //公共字段
    @Comment("创建人员")
    @Column(name = "create_by", length = 32)
    protected String createBy;

    @Comment("创建时间")
    @CreatedDate
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    protected Date created;

    @Comment("修改人员")
    @Column(name = "modify_by", length = 32)
    protected String modifyBy;

    @Comment("修改时间")
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    protected Date modified;

    @Comment("所属组织")
    @Column(name = "owner_org", length = 32)
    protected String ownerOrg;

    @Comment("true：有效 false：无效（逻辑删除）;默认为有效")
    @Column(name = "data_valid"/*, columnDefinition = " boolean DEFAULT true "*/)
    @SavedDefaultValue
    protected Boolean dataValid = Boolean.TRUE;

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(String modifyBy) {
        this.modifyBy = modifyBy;
    }

    public Date getModified() {
        return modified;
    }

    public void setModified(Date modified) {
        this.modified = modified;
    }

    public String getOwnerOrg() {
        return ownerOrg;
    }

    public void setOwnerOrg(String ownerOrg) {
        this.ownerOrg = ownerOrg;
    }

    public Boolean getDataValid() {
        return dataValid;
    }

    public void setDataValid(Boolean dataValid) {
        this.dataValid = dataValid;
    }
}
